﻿<%@ Page Language="C#" MasterPageFile="~/Admin/AdminPage.Master" AutoEventWireup="true"
    CodeBehind="BanEmails.aspx.cs" Inherits="HiTeachers.Web.BanEmails" Title="HiTeachers - Ban email học viên" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphMain" runat="server">
    <div class="admcontent">
        <asp:Label ID="lblMsg" CssClass="SuccMsg" Width="455px" runat="server"></asp:Label><br />
        <table width="100%" cellpadding="3" cellspacing="3">
            <tr>
                <td colspan="2" class="admToolbar">
                    <asp:UpdatePanel ID="updControl" runat="server">
                        <ContentTemplate>
                            <asp:RequiredFieldValidator ID="rfvEmail" ControlToValidate="txtEmail" ValidationGroup="BanEmail"
                                ErrorMessage="Hãy nhập địa chỉ email của bạn!" Display="None" runat="server"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="revEmail" ControlToValidate="txtEmail" ValidationGroup="BanEmail"
                                ErrorMessage="Dịa chỉ email của bạn không hợp lệ!" ValidationExpression="^(\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)$"
                                Display="None" runat="server"></asp:RegularExpressionValidator>&nbsp;&nbsp;&nbsp;
                            <asp:Label ID="lblLockEmail" Text="Email học viên:" runat="server"></asp:Label>&nbsp;
                            <asp:TextBox ID="txtEmail" CssClass="iptBanEmail" Width="200px" runat="server"></asp:TextBox>
                            &nbsp;&nbsp;
                            <!------------------------------------------------->
                            <asp:Button ID="btnBanEmail" CssClass="btnClass" OnClick="BtnBanEmailClick" Text="Ban Email"
                                ValidationGroup="BanEmail" runat="server" />&nbsp;
                            <!------------------------------------------------->
                            <asp:Button ID="btnDelete" Text="Hủy ban" CssClass="btnClass" ToolTip="Hủy ban những email đã đánh dấu!"
                                OnClick="BtnDeleteClick" runat="server" />
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="ddlEmailType" />
                        </Triggers>
                    </asp:UpdatePanel>
                </td>
            </tr>
            <tr>
                <td align="left" valign="bottom">
                    <br />
                    <label class="lblIntrText" style="width: 300px;">
                        Danh sách email</label>
                </td>
                <td align="right" style="padding-top: 5px;">
                    Loai Email:&nbsp;<asp:DropDownList ID="ddlEmailType" OnSelectedIndexChanged="DdlEmailTypeSelectedIndexChanged"
                        AutoPostBack="true" Width="120px" runat="server">
                        <asp:ListItem Value="1" Text="Ban email"></asp:ListItem>
                        <asp:ListItem Value="2" Text="Subcribe Email"></asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
        </table>
        <asp:UpdatePanel ID="udpGrid" UpdateMode="Conditional" runat="server">
            <ContentTemplate>
                <asp:ObjectDataSource ID="objBanEmail" TypeName="HiTeachers.Services.LoggerEmailServices"
                    SelectMethod="GetLoggerEmails" EnablePaging="True" SelectCountMethod="TotalOfLoggerEmail"
                    runat="server">
                    <SelectParameters>
                        <asp:ControlParameter Name="eType" ControlID="ddlEmailType" Direction="Input" Type="String"
                            DefaultValue="1" />
                    </SelectParameters>
                </asp:ObjectDataSource>
                <asp:GridView ID="gridData" DataSourceID="objBanEmail" DataKeyNames="ID" AutoGenerateColumns="False"
                    CellPadding="3" CellSpacing="0" Width="100%" BorderColor="#A4A9B2" BorderWidth="1"
                    CssClass="GrdData" AllowPaging="True" ShowFooter="False" PageSize="20" runat="server">
                    <RowStyle BackColor="#EFF3FB" />
                    <AlternatingRowStyle BackColor="#DAE0EC" />
                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                    <HeaderStyle BackColor="#9399A5" Font-Bold="True" ForeColor="#F2F4F7" Height="25px"
                        HorizontalAlign="Center" />
                    <PagerStyle ForeColor="Black" HorizontalAlign="Right" BackColor="#C6C3C6" />
                    <Columns>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                <input type="Checkbox" id="ChkAll" name="ChkAll" runat="server" onclick="javascript:CheckAll(this.checked);"
                                    title="Chọn tất cả để xóa" />
                            </HeaderTemplate>
                            <ItemTemplate>
                                <input id="chkSelect" onclick="javascript:ItCheck(this.checked);" name="chkItem"
                                    type="checkbox" value='<%# Eval("Id") %>' title="Chọn để xóa" />
                            </ItemTemplate>
                            <AlternatingItemTemplate>
                                <input id="chkSelect" onclick="javascript:ItCheck(this.checked);" name="chkItem"
                                    type="checkbox" value='<%# Eval("Id") %>' title="Chọn để xóa" />
                            </AlternatingItemTemplate>
                            <ItemStyle HorizontalAlign="Center" Width="45px" Height="25px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderStyle-HorizontalAlign="Left">
                            <HeaderTemplate>
                                &nbsp;Email học viên</HeaderTemplate>
                            <ItemTemplate>
                                &nbsp;<asp:Label ID="lblEmail" runat="server" Text='<%# Eval("Email") %>' />
                            </ItemTemplate>
                            <AlternatingItemTemplate>
                                &nbsp;<asp:Label ID="lblEmail" runat="server" Text='<%# Eval("Email") %>' />
                            </AlternatingItemTemplate>
                            <ItemStyle HorizontalAlign="Left" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="100px">
                            <HeaderTemplate>
                                &nbsp;Ngày ban</HeaderTemplate>
                            <ItemTemplate>
                                &nbsp;<asp:Label ID="LblDate" runat="server" Text='<%# Eval("AddedDate","{0:dd/MM/yyyy}") %>' />
                            </ItemTemplate>
                            <AlternatingItemTemplate>
                                &nbsp;<asp:Label ID="LblDate" runat="server" Text='<%# Eval("AddedDate","{0:dd/MM/yyyy}") %>' />
                            </AlternatingItemTemplate>
                            <ItemStyle HorizontalAlign="Left" />
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                Thao tác</HeaderTemplate>
                            <ItemTemplate>
                                <asp:ImageButton ID="IMGDelItem" runat="server" ToolTip="Xóa email này!" ImageUrl="/images/del.gif"
                                    CommandName="Delete" CommandArgument='<%# Eval("ID") %>' OnClientClick="return ConfirmDel();"
                                    Style="cursor: hand" OnCommand="GridDataItemCommand" />
                            </ItemTemplate>
                            <AlternatingItemTemplate>
                                <asp:ImageButton ID="IMGDelItem" runat="server" ToolTip="Xóa email này!" ImageUrl="/images/del.gif"
                                    CommandName="Delete" CommandArgument='<%# Eval("ID") %>' OnClientClick="return ConfirmDel();"
                                    Style="cursor: hand" OnCommand="GridDataItemCommand" />
                            </AlternatingItemTemplate>
                            <ItemStyle HorizontalAlign="Center" Width="65px" />
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="btnDelete" />
                <asp:AsyncPostBackTrigger ControlID="btnBanEmail" />
                <asp:AsyncPostBackTrigger ControlID="ddlEmailType" />
            </Triggers>
        </asp:UpdatePanel>
    </div>
</asp:Content>
